package ComponenteSonido;
import java.awt.Graphics;
import java.applet.Applet;
import java.applet.AudioClip;
import java.io.File;
import java.io.IOException;

import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Clip;
import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.UnsupportedAudioFileException;
import javax.swing.JApplet;

public class Sonido{
	Clip sonido;
	
	public Sonido(String direccion) {
		try {
            Clip sonido = AudioSystem.getClip();
            
            sonido.open(AudioSystem.getAudioInputStream(new File(direccion)));
            
            sonido.start();
            
            while (sonido.isRunning())
                Thread.sleep(1000);
            
            sonido.close();
        } catch (Exception e) {
            System.out.println("" + e);
        }
	}
}


